<template>
  <div class="table-model">
    <h3 class="table-title">
      <img src="../assets/icon-1.png" alt="" />
      感知报警列表
    </h3>
    <el-table :data="alarmList" style="width: 100%">
      <el-table-column
        align="center"
        prop="class"
        label="等级"
      ></el-table-column>
      <el-table-column align="center" prop="status" label="处置状态">
        <template slot-scope="scope">
          <span v-if="scope.row.status === '未处置'">
            <span class="status-icon status-1"></span>
            <span class="text-1">
              {{ scope.row.status }}
            </span>
          </span>
          <span v-if="scope.row.status === '处置中'">
            <span class="status-icon status-2"></span>
            <span class="text-2">
              {{ scope.row.status }}
            </span>
          </span>
          <span v-if="scope.row.status === '已处置'">
            <span class="status-icon status-3"></span>
            <span class="text-3">
              {{ scope.row.status }}
            </span>
          </span>
        </template>
      </el-table-column>
      <el-table-column
        align="center"
        prop="type"
        label="名称"
      ></el-table-column>
      <el-table-column align="center" prop="pos" label="位置"></el-table-column>
      <el-table-column align="center" prop="time" label="时间">
        <template slot-scope="scope">
          <span>
            {{ scope.row.time.split(' ')[1] }}
          </span>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  props: {
    alarmList: Array
  },
  data() {
    return {
      tableData: [
        {
          level: '1',
          status: 3,
          name: '大家',
          location: '候车区',
          time: '10:12:13'
        }
      ]
    };
  },
  filters: {
    statusCn(val) {
      let returnStr = '';
      switch (val) {
        case 1:
          returnStr = '未处置';
          break;
        case 2:
          returnStr = '处置中';
          break;
        case 3:
          returnStr = '已处置';
          break;
      }
      return returnStr;
    }
  }
};
</script>

<style lang="scss" scoped>
.table-model {
  ::v-deep .el-table td,
  ::v-deep .el-table th.is-leaf {
    border-bottom: 1px solid #29304d;
  }
  ::v-deep .el-table th,
  ::v-deep .el-table tr {
    background: #121626;
  }
  ::v-deep .el-table--enable-row-hover .el-table__body tr:hover > td {
    background: #0b0f20;
  }
  ::v-deep .el-table--border::after,
  ::v-deep .el-table--group::after,
  ::v-deep .el-table::before {
    background-color: #29304d;
  }
  ::v-deep .el-table .cell {
    color: #fff;
  }
}

.status-icon {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 50%;
  background: #fff;
  margin-right: 8px;
}
.status-1 {
  background: linear-gradient(#ec924b, #de6173);
}
.status-2 {
  background: linear-gradient(#94ffce, #61daa2);
}
.status-3 {
  background: linear-gradient(#333fff, #333fff);
}
.text-1 {
  color: #de6173;
}
.text-2 {
  color: #61daa2;
}
.text-3 {
  color: #aaa;
}
.table-title {
  font-size: 16px;
  border-bottom: 1px solid #29304d;
  text-align: left;
  padding: 0 20px;
  margin: 0;
  line-height: 44px;
  font-weight: normal;
  img {
    margin-right: 6px;
    vertical-align: middle;
  }
}
</style>
